﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoldenBicycleCompany.Core;
using FluentNHibernate.Mapping;

namespace GoldenBicycleCompany.Data.NHibernateMaps {
    public class LocationMap : ClassMap<Location> {
        public LocationMap() {
            Table("Location");
            Id(x => x.Id, "LocationId");
            Map(x => x.Name, "Name");
            Map(x => x.StreetAddress, "StreetAddress");
            HasMany<Bicycle>(x => x.Inventory)
                .Table("Inventory")
                .KeyColumn("LocationId")
                .AsBag()
                .Cascade.All();        
        }
    }
}
